import {createRouter, createWebHistory} from "vue-router";
//会将所有js混在一起
import Home from "../views/Home";
import User from "../views/User";
import About from "../views/About";

const routes = [
    {
        path: '/',
        name: 'Home',
        // component: Home,
        components: {
            default: Home,
            User,
            About
        }
    },
    {
        path: '/about',
        name: 'About',
        // lazy-load , js单独打包， 加快了页面速度
        // component: () => import('../views/About'),
        components: {
            default: Home,
            User,
            About
        }
    },
    {
        path: '/user',
        component: User,
    }
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router
